package cn.mesmile.object;

import java.io.UnsupportedEncodingException;

/**
 * @author zb
 * @date 2021/2/25 18:33
 * @Description
 */
public class ObjectDemo {
    {
        // 导入dll
        System.load("D:\\IdeaProjects\\xdclass-cloud\\xdclass-native\\" +
                "src\\main\\java\\cn\\mesmile\\object\\Project3.dll");
    }
    /** 从Java层传入一个对象 */
    public native Person getPerson(Person person);

    /**  完全从Native代码中创建对象 */
    public native Person getPerson2();

    public static void main(String[] args) throws UnsupportedEncodingException {
        ObjectDemo objectDemo = new ObjectDemo();
        Person person = new Person("用户名", 93);

        Person person1 = objectDemo.getPerson(person);
        System.out.println("objectDemo.getPerson(person) = " + person1);

        Person person2 = objectDemo.getPerson2();
        System.out.println("person2 = " + person2);
    }

}
